package com.yx.changdao.common.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.github.liaochong.myexcel.core.annotation.IgnoreColumn;
import com.yx.changdao.common.annotation.AutoFill;
import com.yx.changdao.common.utils.SysUtils;
import com.yx.changdao.common.valid.Default;
import com.yx.changdao.common.valid.Update;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

@Getter
@Setter

@TableName(DepWorker.TABLE_NAME)
public class DepWorker implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 数据库名
     */
    public static final String TABLE_NAME = "dep_worker";

    /**
     * 部门工作人员编号
     */
    public static final String DEP_WORKER_ID = "dep_worker_id";
    /**
     * 姓名
     */
    public static final String WORKER_NAME = "worker_name";
    /**
     * 联系方式
     */
    public static final String WORKER_PHONE = "worker_phone";
    /**
     * 身份证号(非必填)
     */
    public static final String WORKER_IDCARD = "worker_idcard";
    /**
     * 所属部门id
     */
    public static final String DEP_ID = "dep_id";
    /**
     * 所属部门名称
     */
    public static final String DEP_NAME = "dep_name";
    /**
     * 所属联户人小组id
     */
    public static final String CONTACT_GROUP_ID = "contact_group_id";
    /**
     * 所属联户人小组id
     */
    public static final String GROUP_NAME = "group_name";
    /**
     * 创建时间
     */
    public static final String CREATE_TIME = "create_time";
    /**
     * 创建人
     */
    public static final String CREATE_BY_NAME = "create_by_name";
    /**
     * 创建人id
     */
    public static final String CREATE_BY = "create_by";
    /**
     * 更新时间
     */
    public static final String UPDATE_TIME = "update_time";
    /**
     * 更新人
     */
    public static final String UPDATE_BY_NAME = "update_by_name";
    /**
     * 更新人id
     */
    public static final String UPDATE_BY = "update_by";


    /**
     * 部门工作人员编号
     */
    @TableId(type = IdType.AUTO)
    @NotNull(message = "部门工作人员编号不能为空", groups = Update.class)
    private Integer depWorkerId;
    /**
     * 姓名
     */
    @NotEmpty(message = "姓名不能为空", groups = {Update.class, Default.class})
    private String workerName;
    /**
     * 联系方式
     */
    @NotEmpty(message = "联系方式不能为空", groups = {Update.class, Default.class})
    private String workerPhone;
    /**
     * 身份证号(非必填)
     */
    private String workerIdcard;
    /**
     * 所属部门id
     */
    private Integer depId;
    /**
     * 所属部门名称
     */
    private String depName;
    /**
     * 所属联户人小组id
     */
    @NotNull(message = "所属联户人小组id不能为空")
    private Integer contactGroupId;
    /**
     * 所属联户人小组名
     */
    private String groupName;
    /**
     * 创建时间
     */
    @IgnoreColumn
    @AutoFill
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    /**
     * 创建人
     */
    @IgnoreColumn
    @AutoFill(klass = SysUtils.class, method = "currentUserName")
    @TableField(fill = FieldFill.INSERT)
    private String createByName;
    /**
     * 创建人id
     */
    @IgnoreColumn
    @AutoFill(klass = SysUtils.class, method = "currentUserId")
    @TableField(fill = FieldFill.INSERT)
    private String createBy;
    /**
     * 更新时间
     */
    @IgnoreColumn
    @AutoFill
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;
    /**
     * 更新人
     */
    @IgnoreColumn
    @AutoFill(klass = SysUtils.class, method = "currentUserName")
    @TableField(fill = FieldFill.UPDATE)
    private String updateByName;
    /**
     * 更新人id
     */
    @IgnoreColumn
    @AutoFill(klass = SysUtils.class, method = "currentUserId")
    @TableField(fill = FieldFill.UPDATE)
    private String updateBy;

}
